package com.hmall.order.interceptor;

public class UserThreadLocal {
    // 定义静态变量
    private  static  ThreadLocal<Long> tl = new ThreadLocal<>();

    // 获取用户id
    public static Long get(){
        return tl.get();
    }
    // 设置用户id
    public static void set(Long userId){
        tl.set(userId);
    }
    // 释放本地线程
    public static void remove(){
        tl.remove();
    }
}
